package com.zhuangxiaoyan.springboot.mybatis.service.impl;

import com.zhuangxiaoyan.springboot.mybatis.Repository.ProductRepository;
import com.zhuangxiaoyan.springboot.mybatis.domain.Product;
import com.zhuangxiaoyan.springboot.mybatis.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xjl
 * @description ProductServiceImpl实现类
 * @createDate 2025-01-11 18:22:55
 */
@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductRepository productRepository;

    @Override
    public int addProduct(Product product) {
        return productRepository.addProduct(product);
    }

    @Override
    public int updateProduct(Product product) {
        return productRepository.updateProduct(product);
    }

    @Override
    public int removeProduct(long id) {
        return productRepository.removeProduct(id);
    }

    @Override
    public Product getProductById(long id) {
        return productRepository.getProductById(id);
    }

    @Override
    public List<Product> getAllProducts() {
        return productRepository.getAllProducts();
    }
}




